Weather
The Weather API in Scripting provides access to real-time and forecast weather data, including current conditions, hourly forecasts, and daily forecasts. This API allows users to fetch weather details such as temperature, wind speed, humidity, and precipitation for a specified location.
Types
UnitType
Represents a unit of measurement with its value, symbol, and formatted string.
UnitTemperature, UnitSpeed, UnitLength, UnitAngle, UnitPressure
These types extend UnitType to represent temperature, speed, length, angle, and pressure.
WeatherCondition
A string enum describing various weather conditions, including:
clearrainsnowthunderstormscloudywindy- ...
Functions
Weather.requestCurrent(location: LocationInfo): Promise<CurrentWeather>
Retrieves the current weather conditions for a given location.
Parameters
location: LocationInfo– The location for which weather data is requested.
Returns
A Promise resolving to a CurrentWeather object.
Example
Weather.requestDailyForecast(location: LocationInfo, options?: { startDate: Date, endDate: Date }): Promise<WeatherDailyForecast>
Retrieves the daily weather forecast for the specified location. You can optionally provide a start and end date to specify the forecast range.
Parameters
location: LocationInfo– The location to query.options.startDate– The start date for the forecast.options.endDate– The end date for the forecast.
Returns
A Promise resolving to a WeatherDailyForecast object.
Example
Weather.requestHourlyForecast(location: LocationInfo, options?: { startDate: Date, endDate: Date }): Promise<WeatherHourlyForecast>
Retrieves the hourly weather forecast for the specified location. You can optionally provide a start and end date to specify the forecast range.
Parameters
location: LocationInfo– The location to query.options.startDate– The start date for the forecast.options.endDate– The end date for the forecast.
Returns
A Promise resolving to a WeatherHourlyForecast object.
Example
CurrentWeather
Represents the current weather conditions.
WeatherDailyForecast
Represents the daily forecast.
WeatherHourlyForecast
Represents the hourly forecast.
DayWeather
Represents daily weather details.
HourWeather
Represents hourly weather details.
